package au.chao.client.frame.chat;

import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JSplitPane;

import net.miginfocom.swing.MigLayout;
import au.chao.util.ScreenUtil;

public class ChatFrame extends JFrame {
	private static final long serialVersionUID = 1L;
	private ChatPanelLeft left;
	private ChatPanelRight right;
	private JSplitPane splitPane;

	public ChatFrame(String title) {
		super(title);
		init();
	}

	private void init() {
		left = new ChatPanelLeft(this);
		right = new ChatPanelRight(this);
		getContentPane().setLayout(new MigLayout());
		splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, right);
		getContentPane().add(splitPane);
		setResizable(false);
		pack();
		Dimension screenSize = ScreenUtil.getScreenSize();
		setLocation(screenSize.width / 2 - getSize().width / 2,
				screenSize.height / 2 - getSize().height / 2);
	}

	public ChatPanelLeft getLeft() {
		return left;
	}

	public void setLeft(ChatPanelLeft left) {
		this.left = left;
	}

	public ChatPanelRight getRight() {
		return right;
	}

	public void setRight(ChatPanelRight right) {
		this.right = right;
	}
}
